import java.util.UUID
import java.net.URLDecoder


object Test {
    def main(args: Array[String]): Unit = {
     /* val nginxSplit=""" \"(.*?)\"""".r//普通nginx日志切分
      val dddd="""111.121.48.146 - - [15/Jun/2017:23:04:33 +0800] "GET /app.js?sver=4.0&uid=0db99f46814c4805b1d36114221263ec_1497512431683&tm=1497538994733&from=&spid=&appid=3_it8a4s3k14&version=" 408 0 "-" "-""""
      val dsfds="""202.39.224.234 - - [16/Jun/2017:13:39:48 +0800] "GET /app.js?sver=3.3&uid=1491967788053_98AAFFDCC81A48D85480690D997BACC9&tm=1496846586491&from=youyi&spid=003_movie&appid=movie&version=6.2.0&eventid=1500&uri=%E3%80%8A%E4%BD%A0%E7%9A%84%E5%90%8D%E5%AD%97%E3%80%8B%E4%B8%AD%E6%96%87%E5%AE%A3%E4% HTTP/1.1" 200 0 "https://www.google.com.tw" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101 Firefox/47.0""""
      val ddfs=dsfds.replaceAll("%(?![0-9a-fA-F]{2})", "%25");
      val data = ddfs.replaceAll("\\+", "%2B");
      println(URLDecoder.decode(data,"utf-8"))*/
      val list=Array("a","b","b")
      list  match {
         case Array(x,y,z,_*) => println("3个参数")
         //case Array(x,y,z,s) => println("4个参数")
         case _ => println("-------")
      }
      //val urlandtype=nginxSplit.findAllIn(dddd).toList
     // println(urlandtype(0).split(" ").toList)
      //val ddd= """140.255.204.29 - - [15/Jul/2016:06:28:25 +0800] "GET /page.js?sver=3.1&uid=1468535304000_iezc4z2576&tm=1468535304000&from=cnlive&spid=cnlive&appid=web_cnlive&version=1.0.0&ref=https%3A%2F%2Fm.baidu.com%2Ffrom%3D1011147e%2Fbd_page_type%3D1%2Fssid%3D0%2Fuid%3D0%2Fbaiduid%3D0A4098DE113847A980CF088347B766F8%2Fw%3D0_10_2016%25E5%25B9%25B47%25E6%259C%258815%25E6%2597%25A5%25E6%2591%2594%25E8%25B7%25A4%25E4%25BD%2593%25E8%2582%25B2%25E9%25A2%2591%25E5%25AF%25BC%2Ft%3Dzbios%2Fl%3D1%2Ftc%3Fref%3Dwww_zbios%26pu%3Dsz%25401320_480%252Ccuid%2540_u25i_iaSigF8virlPHk8_uPHugAPvutgivqtl8xS8ifu28JgavVt_aN2iAlTocoC%252Ccua%2540_a2IiyuC2ig-NE6lI5me6NNy2I_UCvC53GNqA%252Ccut%2540pfs8uYaAvfyjaXiDouD58gNXxoku5FqJjycQB%252Cosname%2540baiduboxapp%252Cctv%25402%252Ccfrom%25401000813a%252Ccen%2540cuid_cua_cut%252Ccsrc%2540home_box_txt%252Cta%2540zbios_2_6.0_6_7.3%252Cusm%25400%252Cvmgdb%25400020100228y%26lid%3D16711519785430886708%26order%3D6%26fm%3Dalop%26tj%3Dwww_normal_6_0_10_title%26url_mf_score%3D5%26vit%3Dosres%26m%3D8%26cltj%3Dcloud_title%26asres%3D1%26title%3D%25E5%2585%25A8%25E5%259B%25BD%25E7%2594%25B7%25E5%25AD%2590%25E8%2587%25AA%25E7%2594%25B1%25E5%25BC%258F%25E6%2591%2594%25E8%25B7%25A4%25E9%259D%2592%25E5%25B9%25B4%25E9%2594%25A6%25E6%25A0%2587%25E8%25B5%259B7%25E6%259C%258815-18%25E6%2597%25A5%26dict%3D32%26sec%3D13726%26di%3Def0ff5114e76490c%26bdenc%3D1%26tch%3D124.0.293.913.2.4639%26nsrc%3DIlPT2AEptyoA_yixCFOxXnANedT62v3IFQKORzpHLDm7pE37xP4kHRhdXHKhVmaPF5SwdoSPe12WaCXyKz6fnAV2mu5-eih8kjm7uaefscaLHqJ2qcU-1dqTR8Bso0bF8_5vduJyRMEzU76iyLq9tsMmfhaA%26eqid%3De7eb3eb41385280010000002578811e4%26wd%3D%26clk_info%3D%257B%2522srcid%2522%253A%2522www_normal%2522%252C%2522tplname%2522%253A%2522www_normal%2522%252C%2522t%2522%253A1468535302802%252C%2522xpath%2522%253A%2522div-div-div-a-p%2522%257D%26ant_ct%3DbnQAjRdoSXMVlp%25395HPk%252FlVMxr3NaoggeCwDgmLVo%255ATffh6Km3G%252FLpMmcmtxy6M%252B%255AEhlx0%2539hlaW%257AihxwwmADOMA%253D%253D&uri=http%3A%2F%2Fsports.china.com.cn%2Fphone%2Fqita%2Fqinghaitiyu%2Fsaishitonggao%2Fdetail1_2016_06%2F30%2F493801.html HTTP/1.1" 200 0 "http://sports.china.com.cn/phone/qita/qinghaitiyu/saishitonggao/detail1_2016_06/30/493801.html" "Mozilla/5.0 (Linux; Android 6.0.1; SM-G9209 Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/35.0.1916.138 Mobile Safari/537.36 T7/6.3 rabbit/1.0 baiduboxapp/7.3.1 (Baidu; P1 6.0.1)""""
      //println(URLDecoder.decode(ddd,"utf-8"))
      
     // """60.25.112.219 - - [01/Jun/2016:14:54:51 +0800] "GET /page.js?sver=3.1&uid=1464764477000_73kv3g4925&tm=1464764477000&from=cnlive&spid=cnlive&appid=web_cnlive&version=1.0.0&ref=http%3A%2F%2Fwww.cnlive.com%2F&uri=http%3A%2F%2Fm.cnlive.com%2F HTTP/1.1" -200 0 "http://m.cnlive.com/" "Mozilla/5.0 (Linux; U; Android 4.2.2; zh-cn; vivo S7i(t) Build/JDQ39) AppleWebKit/534.24 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.24 T5/2.0 baiduboxapp/5.0 (Baidu; P1 4.2.2)""""
      //val f= """106.117.63.44 - - [01/Jun/2016:17:31:13 +0800] "GET /page.js?sver=3.1&uid=1464773473000_kgpapw2682&tm=1464773473000&from=cnlive&spid=cnlive&appid=web_cnlive&version=1.0.0&ref=http%3A%2F%2Fnews.cntv.cn%2F2015%2F11%2F28%2FVIDE1448688481854189.shtml&uri=http%3A%2F%2Fwww.cnlive.com%2F HTTP/1.1" -200 0 "http://www.cnlive.com/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)""""
     // val dd="""111.51.101.236 - - [01/Jun/2016:12:34:33 +0800] "GET /page.js?sver=3.1&uid=1464755296000_p14ia57769&tm=1464755806000&from=cnlive&spid=cnlive&appid=web_cnlive&version=1.0.0&ref=http%3A%2F%2Fbm.fc.cnlive.com%2Fh5%2Fapplay%3Ffrmid%3Dfcwxgansujiuquan&uri=http%3A%2F%2Fbm.fc.cnlive.com%2Fh5%2Fapplay%3Ffrmid%3Dfcwxgansujiuquan HTTP/1.1" -200 0 "http://bm.fc.cnlive.com/h5/applay?frmid=fcwxgansujiuquan" "Mozilla/5.0 (iPad; CPU OS 9_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13C75 MicroMessenger/6.3.16 NetType/WIFI Language/zh_CN""""
     /* val capitals = Map("France"->"Paris", "Japan"->"Tokyo","China"->"Beijing")
      capitals.get("Frane")  match {
        case Some(s)  => println(s)
        case None => println("---")
      }*/
      
           /*  val lineText3="""182.87.147.122 - - [08/May/2017:10:30:01 +0800] "GET /app.js?sver=3.3&uid=1485183089220_67e74da4bb59465698b332ac7237cda4&tm=1485183089220&from=video_sdk&spid=672db30805f848f59ec3728f8347a4a0&appid=iqhok80f55&version=7.6.0&eventid=1300&uri=&sid=0&plat=a HTTP/1.1" 200 0 "-" "Dalvik/2.1.0 (Linux; U; Android 6.0; HUAWEI MLA-AL10 Build/HUAWEIMLA-AL10)""""
             
       println(lineText3.size*1000000/1024/1024/3)
      
      
      
      val dd="1494210652000_j1tsu24521"
      val ddd=dd.split("_")
      println(ddd(1).matches("^[0-9]*$"))*/
      
      
      
      
      
      
      
      
      
      
      
      
     /* val ts=""" \"(.*?)\"""".r
        val matchLit="""([^ ]*)"""
        val dd="117.136.4.65,"
          println(dd.matches(matchLit))
      val matcheLine1="""([^ ]*) ([^ ]*) ([^ ]*) \[(.*)\] \"GET(.*?)\" (-|[0-9]*) (-|[0-9]*) \"(.*?)\" \"(.*?)\""""
       val matcheLine="""([^ ]*) ([^ ]*) ([^ ]*) \[(.*)\] \"GET(.*?)\" (-|[0-9]*) (-|[0-9]*) \"(.*?)\" \"(.*?)\""""
       val lineText2= """117.136.4.65, 10.40.11.53, 220.181.51.39 - - [01/Jun/2016:03:40:56 +0800] "GET /page.js?sver=3.1&uid=1464723656000_bi2fjh4180&tm=1464723656000&from=cnlive&spid=cnlive&appid=web_cnlive&version=1.0.0&ref=http%3A%2F%2Fwww.cnlive.com%2F&uri=http%3A%2F%2Fm.cnlive.com%2F HTTP/1.1" 200 0 "http://m.cnlive.com/" "Mozilla/5.0 (iphone; U; CPU iPhone OS 4_3_5 like Mac OS X; zh-cn) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5""""
       val lineText= """117.136.4.65, 10.40.11.53, 220.181.51.39 - - [01/Jun/2016:03:40:56 +0800] "GET /page.js?sver=3.1&uid=1464723656000_bi2fjh4180&tm=1464723656000&from=cnlive&spid=cnlive&appid=web_cnlive&version=1.0.0&ref=http%3A%2F%2Fwww.cnlive.com%2F&uri=http%3A%2F%2Fm.cnlive.com%2F HTTP/1.1" 200 0 "http://m.cnlive.com/" "Mozilla/5.0 (iphone; U; CPU iPhone OS 4_3_5 like Mac OS X; zh-cn) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5""""
       val lineText3="""182.87.147.122 - - [08/May/2017:10:30:01 +0800] "GET /app.js?sver=3.3&uid=1485183089220_67e74da4bb59465698b332ac7237cda4&tm=1485183089220&from=video_sdk&spid=672db30805f848f59ec3728f8347a4a0&appid=iqhok80f55&version=7.6.0&eventid=1300&uri=&sid=0&plat=a HTTP/1.1" 200 0 "-" "Dalvik/2.1.0 (Linux; U; Android 6.0; HUAWEI MLA-AL10 Build/HUAWEIMLA-AL10)""""
      // println(lineText3.matches(matcheLine))
       val ipandtime=ts.split(lineText).toList
       val urlandtype=ts.findAllIn(lineText).toList
       println(ipandtime)
      println(ipandtime.length)
       println(urlandtype)
       val ipandtimeArr= ipandtime(0).split(" ")
       println(ipandtimeArr.length)
       println(ipandtimeArr)
       println(ipandtimeArr(0))
       println( if (ipandtimeArr(0).indexOf(",") != -1)ipandtimeArr(0).substring(0, ipandtimeArr(0).indexOf(",")) else ipandtimeArr(0))
       val timeIndx=ipandtimeArr.length-2
        val time=ipandtimeArr(timeIndx).replace("[", "")
        println(time)*/
       
       
      //println(lineText.matches(matcheLine))
       /*println(lineText2.hashCode())
       println(lineText.hashCode())
       println(UUID.randomUUID())*/
      
    }
}